<% if @song.errors.empty? %>
    new_song = "<%= j render 'song', song: @song, index: true %>";
    $('#songs').prepend(new_song);
    animated();
<% else %>
  $('#song-errors').html("<%= j render 'shared/error_messages', object: @song %>");
  $('#error_explanation').transition('tada');
<% end %>
$('.ui.form').removeClass('loading')
$('.ui.form .button').removeClass('disabled')

function animated() {
  $('#error_explanation').html("");
  $('#song-<%= @song.id %>').addClass('animated flipInX');
  $('#new_song').trigger('reset');
  $('.close.red').click();
}